home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2000 February / Macworld (2000-02).dmg / Cool Extras! / WallBall Screen Saver / WallBall.dxr / 00011.ls < prev    next >
Encoding:
Text File  |  1999-11-11  |  2.1 KB  |  104 lines

  1. global gRemainingBalls, gBrickMax, gBrickNum, gBallSpeed, gPaused, gCurrentSection
  2.  
  3. on startMovie
  4.   gPaused = 1
  5.   gRemainingBalls = 3
  6.   gBrickMax = 16
  7.   if the machineType = 256 then
  8.     the soundDevice = "QT3MIX"
  9.   end if
  10.   put gRemainingBalls into member "RemainingBalls"
  11.   set the timeoutLength to 60 * 60 * 1
  12. end
  13.  
  14. on timeout
  15.   global gCurrentSection
  16.   if gPaused = 1 then
  17.     go("Attract")
  18.   end if
  19. end
  20.  
  21. on checkkey
  22.   quit()
  23. end
  24.  
  25. on setCurrentSection sectionName
  26.   gCurrentSection = sectionName
  27. end
  28.  
  29. on initCurrentSection
  30.   case gCurrentSection of
  31.     "Level 1":
  32.       if the frameLabel <> 0 then
  33.         gRemainingBalls = 3
  34.         put gRemainingBalls into member "RemainingBalls"
  35.         gBrickNum = 0
  36.       end if
  37.       gBallSpeed = 2
  38.     "Level 2":
  39.       if the frameLabel <> 0 then
  40.         gBrickNum = 0
  41.       end if
  42.       gBallSpeed = 3
  43.     "Level 3":
  44.       if the frameLabel <> 0 then
  45.         gBrickNum = 0
  46.       end if
  47.       gBallSpeed = 4
  48.     "Looser 1", "Looser 2", "Looser 3", "GameOver", "Winner", "Exit":
  49.       gPaused = 1
  50.       puppetSound(0)
  51.       puppetSound(2, 0)
  52.       puppetSound(3, 0)
  53.   end case
  54. end
  55.  
  56. on togglePausePlay
  57.   global gPaused
  58.   gPaused = not gPaused
  59.   case gCurrentSection of
  60.     "Looser 1", "Looser 2", "Looser 3", "GameOver", "Exit":
  61.       go("Level 1")
  62.   end case
  63. end
  64.  
  65. on launchBall
  66.   initCurrentSection()
  67.   updateReaminingBallReadout()
  68.   ballS = 100
  69.   sprite(ballS).member = member("ball" && gCurrentSection)
  70.   sprite(ballS).loc = point(320, 240)
  71.   sendSprite(100, #beginSprite)
  72. end
  73.  
  74. on updateReaminingBallReadout
  75.   global gRemainingBalls, gCurrentSection
  76.   gRemainingBalls = gRemainingBalls - 1
  77.   put gRemainingBalls into member "RemainingBalls"
  78.   if gRemainingBalls = 0 then
  79.     case gCurrentSection of
  80.       "Level 1":
  81.         go("Looser 1")
  82.       "Level 2":
  83.         go("Looser 2")
  84.       "Level 3":
  85.         go("Looser 3")
  86.     end case
  87.   end if
  88. end
  89.  
  90. on goURL url
  91.   gotoNetPage(url)
  92. end
  93.  
  94. on HyperlinkClicked me, url
  95.   gotoNetPage(url)
  96. end
  97.  
  98. on wait ticks
  99.   startDelay = the timer
  100.   repeat while the timer < (startDelay + ticks)
  101.     updateStage()
  102.   end repeat
  103. end
  104.